package org.anti996.lms;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;

import java.util.Collections;

public class CodeGenerator {
    public static void main(String[] args) {
        // 需要改为自己的路径
        String outputDir = "/home/hamlet/Codebase/Homework/lms-backend/src/main/";
        FastAutoGenerator.create("jdbc:mysql://localhost:3306/lms", "hamlet", "fpl0314")
                .globalConfig(builder -> builder
                        .author("The Anti996 Authors")
                        .enableSwagger()
                        .outputDir(outputDir + "java"))
                .packageConfig(builder -> builder
                        .parent("org.anti996")
                        .entity("model")
                        .moduleName("lms")
                        .pathInfo(Collections.singletonMap(OutputFile.xml, outputDir + "resources/mappers")))
                .strategyConfig(builder -> builder
                        .entityBuilder()
                        .enableLombok()
                        .controllerBuilder()
                        .enableRestStyle()
                        .serviceBuilder()
                        .formatServiceFileName("%sService"))
                .execute();
    }
}
